<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="utf-8">
<title>财务汇总</title>
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<link rel="stylesheet" type="text/css" href="../plugin/layui/css/layui.css" media="all" />
<link rel="stylesheet" type="text/css" href="../src/lvdong/css/financialSummary.css" media="all" />
<script src="../plugin/jquery.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../plugin/layui/layui.js" type="text/javascript" charset="utf-8"></script>
<script src="../plugin/layui/layui.all.js" type="text/javascript" charset="utf-8"></script>
<script src="../plugin/echarts.js" type="text/javascript" charset="utf-8"></script>
</head>
<body>
	<div class="title">
		<blockquote class="layui-elem-quote" style="font-size: 30px;">
			实时信息&nbsp;&nbsp;<span id="datetime"></span>
		</blockquote>
	</div>
	<div id="abstract">
		<div class="absDis">
			<div class="img" id="imgcolor01">
				<i class="layui-icon layui-icon-rmb" style="font-size: 95px; color: #ffffff;"></i>
			</div>
			<div class="showNum">
				<h4>充值总额</h4>
				<span id="totalRecharge"></span> <span>RMB</span>
			</div>
		</div>
		<div class="absDis">
			<div class="img" id="imgcolor02">
				<i class="layui-icon layui-icon-rmb" style="font-size: 95px; color: #ffffff;"></i>
			</div>
			<div class="showNum">
				<h4>消费总额</h4>
				<span id="totalConsumption"></span> <span>RMB</span>
			</div>
		</div>
		<div class="absDis">
			<div class="img" id="imgcolor03">
				<i class="layui-icon layui-icon-rmb" style="font-size: 95px; color: #ffffff;"></i>
			</div>
			<div class="showNum">
				<h4>总收入</h4>
				<span id="totalRevenue"></span> <span>RMB</span>
			</div>
		</div>
		<div class="absDis">
			<div class="img" id="imgcolor04">
				<i class="layui-icon layui-icon-rmb" style="font-size: 95px; color: #ffffff;"></i>
			</div>
			<div class="showNum">
				<h4>总盈利</h4>
				<span id="totalProfit"></span> <span>RMB</span>
			</div>
		</div>
	</div>
	<div class="title">
		<blockquote class="layui-elem-quote" style="font-size: 30px;">统计图</blockquote>
	</div>
	<div id="chart">
		<div id="dateselect">
			<div style="float: left; margin-left: 50px; margin-top: 15px; font-size: 20px; color: #ffffff;">日期选择:</div>
			<div class="layui-form" style="width: 200px; float: left; margin-left: 20px; margin-top: 10px;">
				<select name="daterange" id="daterange">
					<option value=""></option>
				</select>
			</div>
		</div>
		<div id="rechargeChart" class="chartstyle"></div>
		<div id="consumptionChart" class="chartstyle"></div>
		<div id="revenueChart" class="chartstyle"></div>
		<div id="profitChart" class="chartstyle"></div>
	</div>
	<div class="title">
		<blockquote class="layui-elem-quote" style="font-size: 30px;">汇总报表</blockquote>
	</div>
	<div id="summary">
		<table class="layui-hide" id="summarytable" lay-filter="summarytable"></table>
	</div>
	<div id="updateform" style="display: none;">
		<div class="formList">
			<div class="layui-form">
				<form class="layui-form layui-form-pane" action="./insertOrUpdate">
					<div class="layui-form-item">
						<label class="layui-form-label">序号：</label>
						<div class="layui-input-block">
							<input name="id" id="id" class="layui-input" type="text" autocomplete="off" readonly="readonly"
								style="background-color: rgb(228, 228, 228);">
						</div>
					</div>
					<div class="layui-form-item">
						<label class="layui-form-label">所属机构：</label>
						<div class="layui-input-block">
							<input name="affiliation" id="affiliation" class="layui-input" type="text" placeholder="所属机构名称" autocomplete="off"
								lay-verify="required">
						</div>
					</div>
					<div class="layui-form-item">
						<label class="layui-form-label">营业日期：</label>
						<div class="layui-input-block">
							<input class="layui-input" name="business_date" id="business_date" type="text" placeholder="日期：yyyy-MM-dd"
								lay-verify="required">
						</div>
					</div>
					<div class="layui-form-item">
						<label class="layui-form-label">充值总额：</label>
						<div class="layui-input-block">
							<input name="total_recharge" id="total_recharge" class="layui-input" type="text" placeholder="请输入金额" autocomplete="off"
								lay-verify="required|number">
						</div>
					</div>
					<div class="layui-form-item">
						<label class="layui-form-label">消费总额：</label>
						<div class="layui-input-block">
							<input name="total_consumption" id="total_consumption" class="layui-input" type="text" placeholder="请输入金额"
								autocomplete="off" lay-verify="required|number">
						</div>
					</div>
					<div class="layui-form-item">
						<label class="layui-form-label">结算退还总额：</label>
						<div class="layui-input-block">
							<input name="total_settlement_refund" id="total_settlement_refund" class="layui-input" type="text" placeholder="请输入金额"
								autocomplete="off" lay-verify="required|number">
						</div>
					</div>
					<div class="layui-form-item">
						<label class="layui-form-label">租金总额：</label>
						<div class="layui-input-block">
							<input name="total_rent" id="total_rent" class="layui-input" type="text" placeholder="请输入金额" autocomplete="off"
								lay-verify="required|number">
						</div>
					</div>
					<div class="layui-form-item">
						<label class="layui-form-label">押金扣除总额：</label>
						<div class="layui-input-block">
							<input name="total_deposit_deduction" id="total_deposit_deduction" class="layui-input" type="text" placeholder="请输入金额"
								autocomplete="off" lay-verify="required|number">
						</div>
					</div>
					<div class="layui-form-item">
						<label class="layui-form-label">消费项调整总额：</label>
						<div class="layui-input-block">
							<input name="total_consumption_adjustment" id="total_consumption_adjustment" class="layui-input" type="text"
								placeholder="请输入金额" autocomplete="off" lay-verify="required|number">
						</div>
					</div>
					<div class="layui-form-item">
						<label class="layui-form-label">未退金额：</label>
						<div class="layui-input-block">
							<input name="outstanding_amount" id="outstanding_amount" class="layui-input" type="text" placeholder="请输入金额"
								autocomplete="off" lay-verify="required|number">
						</div>
					</div>
					<div class="layui-form-item">
						<label class="layui-form-label">余额退还：</label>
						<div class="layui-input-block">
							<input name="refund_of_balance" id="refund_of_balance" class="layui-input" type="text" placeholder="请输入金额"
								autocomplete="off" lay-verify="required|number">
						</div>
					</div>
					<div class="layui-input-block" style="display: none;">
						<button class="layui-btn" type="submit" style="display: none;">提交</button>
					</div>
				</form>
			</div>
		</div>
	</div>
	<script>
		layui.use('laydate', function() {
			var laydate = layui.laydate;
			laydate.render({
				elem : '#business_date'
			});
		});
		layui
				.use(
						'table',
						function() {
							var table = layui.table;

							table.render({
								elem : '#summarytable',
								url : './financialSummary',
								height : 'full-200',
								limit : 30,
								toolbar : 'default',
								cols : [ [ {
									type : 'checkbox',
									fixed : 'left'
								}, {
									field : 'id',
									width : 80,
									align : 'center',
									title : '序号'
								}, {
									field : 'affiliation',
									align : 'center',
									title : '所属机构'
								}, {
									field : 'business_date',
									align : 'center',
									sort : true,
									title : '营业日期'
								}, {
									field : 'total_recharge',
									align : 'center',
									sort : true,
									title : '充值总额'
								}, {
									field : 'total_consumption',
									align : 'center',
									sort : true,
									title : '消费总额'
								}, {
									field : 'total_settlement_refund',
									align : 'center',
									width : 160,
									sort : true,
									title : '结算退还总额'
								}, {
									field : 'total_rent',
									align : 'center',
									sort : true,
									title : '租金总额'
								}, {
									field : 'total_deposit_deduction',
									align : 'center',
									width : 160,
									sort : true,
									title : '押金扣除总额'
								}, {
									field : 'total_consumption_adjustment',
									width : 200,
									align : 'center',
									sort : true,
									title : '消费项调整总额'
								}, {
									field : 'outstanding_amount',
									align : 'center',
									sort : true,
									title : '未退金额'
								}, {
									field : 'refund_of_balance',
									align : 'center',
									sort : true,
									title : '余额退还'
								} ] ],
								page : true
							});
							//头工具栏事件
							table
									.on(
											'toolbar(summarytable)',
											function(obj) {
												var checkStatus = table
														.checkStatus(obj.config.id), data = checkStatus.data; //获取选中的数据
												switch (obj.event) {
												case 'add':
													layer
															.open({
																type : 1 //页面层
																,
																title : '添加',
																area : [
																		'700px',
																		'760px' ],
																shade : 0,
																maxmin : true,
																content : $('#updateform'),
																btn : [ '确定',
																		'取消' ],
																success : function(
																		layero,
																		index) {
																	$("#id")
																			.val(
																					"");
																	$(
																			"#affiliation")
																			.val(
																					"");
																	$(
																			"#business_date")
																			.val(
																					"");
																	$(
																			"#total_recharge")
																			.val(
																					"");
																	$(
																			"#total_consumption")
																			.val(
																					"");
																	$(
																			"#total_settlement_refund")
																			.val(
																					"");
																	$(
																			"#total_rent")
																			.val(
																					"");
																	$(
																			"#total_deposit_deduction")
																			.val(
																					"");
																	$(
																			"#total_consumption_adjustment")
																			.val(
																					"");
																	$(
																			"#outstanding_amount")
																			.val(
																					"");
																	$(
																			"#refund_of_balance")
																			.val(
																					"");
																},
																yes : function(
																		index,
																		layero) {
																	$(
																			".layui-btn")
																			.click();
																}
															})
													break;
												case 'update':
													if (data.length === 0) {
														layer.msg('请选择一行');
													} else if (data.length > 1) {
														layer.msg('只能同时编辑一个');
													} else {
														layer
																.open({
																	type : 1 //页面层
																	,
																	title : '修改',
																	area : [
																			'700px',
																			'760px' ],
																	shade : 0,
																	maxmin : true,
																	content : $('#updateform'),
																	btn : [
																			'确定',
																			'取消' ],
																	success : function(
																			layero,
																			index) {
																		$("#id")
																				.val(
																						checkStatus.data[0].id);
																		$(
																				"#affiliation")
																				.val(
																						checkStatus.data[0].affiliation);
																		$(
																				"#business_date")
																				.val(
																						checkStatus.data[0].business_date);
																		$(
																				"#total_recharge")
																				.val(
																						checkStatus.data[0].total_recharge);
																		$(
																				"#total_consumption")
																				.val(
																						checkStatus.data[0].total_consumption);
																		$(
																				"#total_settlement_refund")
																				.val(
																						checkStatus.data[0].total_settlement_refund);
																		$(
																				"#total_rent")
																				.val(
																						checkStatus.data[0].total_rent);
																		$(
																				"#total_deposit_deduction")
																				.val(
																						checkStatus.data[0].total_deposit_deduction);
																		$(
																				"#total_consumption_adjustment")
																				.val(
																						checkStatus.data[0].total_consumption_adjustment);
																		$(
																				"#outstanding_amount")
																				.val(
																						checkStatus.data[0].outstanding_amount);
																		$(
																				"#refund_of_balance")
																				.val(
																						checkStatus.data[0].refund_of_balance);
																	},
																	yes : function(
																			index,
																			layero) {
																		$(
																				".layui-btn")
																				.click();
																	}
																});
													}
													break;
												case 'delete':
													if (data.length === 0) {
														layer.msg('请选择一行');
													} else {
														layer
																.confirm(
																		'确定删除吗',
																		function(
																				index) {
																			var tmp = new Array(
																					checkStatus.data.length);
																			for (let index = 0; index < checkStatus.data.length; index++) {
																				tmp[index] = checkStatus.data[index].id;
																			}
																			$
																					.ajax({
																						type : 'POST',
																						url : './delete',
																						contentType : "application/json",
																						data : JSON
																								.stringify(tmp),
																						success : function(
																								data) {
																							location
																									.reload();
																						}
																					});
																			layer
																					.close(index);
																		});
													}
													break;
												}
												;
											});
						});
	</script>
	<script>
		$(function() {
			$.post("./total", function(result) {
				$("#totalRecharge").html(result[0]);
				$("#totalConsumption").html(result[1]);
				$("#totalRevenue").html(result[2]);
				$("#totalProfit").html(result[3]);
				var d = new Date();
				var datetime = d.getFullYear() + '-' + (d.getMonth() + 1) + '-'
						+ d.getDate();
				$('#datetime').html(datetime);
			});
		});
	</script>
	<script type="text/javascript">
		// 基于准备好的dom，初始化echarts实例
		var rechargeChart = echarts.init(document
				.getElementById('rechargeChart'));
		var consumptionChart = echarts.init(document
				.getElementById('consumptionChart'));
		var revenueChart = echarts
				.init(document.getElementById('revenueChart'));
		var profitChart = echarts.init(document.getElementById('profitChart'));
		layui
				.use(
						[ 'form', 'upload', 'layer' ],
						function() {
							var form = layui.form;
							$
									.post(
											"./week",
											function(result) {
												var i = 0;
												for ( var key in result) {
													var tmp = key + "---"
															+ result[key];
													i++;
													$('#daterange').append(
															new Option(tmp));// 下拉菜单里添加元素
													if (i == 1) {
														$('#daterange')
																.val(tmp);
														$
																.post(
																		"./weekSummary",
																		{
																			monday : result[key],
																			sunday : key
																		},
																		function(
																				data) {
																			// 指定图表的配置项和数据
																			var rechargeOption = {
																				title : {
																					text : '充值总额'
																				},
																				tooltip : {},
																				legend : {
																					data : [
																							'充值总额',
																							'累计充值' ]
																				},
																				xAxis : {
																					data : [
																							data.summaryReports[0].business_date,
																							data.summaryReports[1].business_date,
																							data.summaryReports[2].business_date,
																							data.summaryReports[3].business_date,
																							data.summaryReports[4].business_date,
																							data.summaryReports[5].business_date,
																							data.summaryReports[6].business_date ]
																				},
																				yAxis : {},
																				series : [
																						{
																							name : '充值总额',
																							type : 'line',
																							data : [
																									data.summaryReports[0].total_recharge,
																									data.summaryReports[1].total_recharge,
																									data.summaryReports[2].total_recharge,
																									data.summaryReports[3].total_recharge,
																									data.summaryReports[4].total_recharge,
																									data.summaryReports[5].total_recharge,
																									data.summaryReports[6].total_recharge ]
																						},
																						{
																							name : '累计充值',
																							type : 'line',
																							data : [
																									data.summaryReports[0].total_recharge,
																									data.summaryReports[0].total_recharge
																											+ data.summaryReports[1].total_recharge,
																									data.summaryReports[0].total_recharge
																											+ data.summaryReports[1].total_recharge
																											+ data.summaryReports[2].total_recharge,
																									data.summaryReports[0].total_recharge
																											+ data.summaryReports[1].total_recharge
																											+ data.summaryReports[2].total_recharge
																											+ data.summaryReports[3].total_recharge,
																									data.summaryReports[0].total_recharge
																											+ data.summaryReports[1].total_recharge
																											+ data.summaryReports[2].total_recharge
																											+ data.summaryReports[3].total_recharge
																											+ data.summaryReports[4].total_recharge,
																									data.summaryReports[0].total_recharge
																											+ data.summaryReports[1].total_recharge
																											+ data.summaryReports[2].total_recharge
																											+ data.summaryReports[3].total_recharge
																											+ data.summaryReports[4].total_recharge
																											+ data.summaryReports[5].total_recharge,
																									data.summaryReports[0].total_recharge
																											+ data.summaryReports[1].total_recharge
																											+ data.summaryReports[2].total_recharge
																											+ data.summaryReports[3].total_recharge
																											+ data.summaryReports[4].total_recharge
																											+ data.summaryReports[5].total_recharge
																											+ data.summaryReports[6].total_recharge ]
																						} ]
																			};
																			var consumptionOption = {
																				title : {
																					text : '消费总额'
																				},
																				tooltip : {},
																				legend : {
																					data : [
																							'消费总额',
																							'累计消费' ]
																				},
																				xAxis : {
																					data : [
																							data.summaryReports[0].business_date,
																							data.summaryReports[1].business_date,
																							data.summaryReports[2].business_date,
																							data.summaryReports[3].business_date,
																							data.summaryReports[4].business_date,
																							data.summaryReports[5].business_date,
																							data.summaryReports[6].business_date ]
																				},
																				yAxis : {},
																				series : [
																						{
																							name : '消费总额',
																							type : 'line',
																							data : [
																									data.summaryReports[0].total_consumption,
																									data.summaryReports[1].total_consumption,
																									data.summaryReports[2].total_consumption,
																									data.summaryReports[3].total_consumption,
																									data.summaryReports[4].total_consumption,
																									data.summaryReports[5].total_consumption,
																									data.summaryReports[6].total_consumption ]
																						},
																						{
																							name : '累计消费',
																							type : 'line',
																							data : [
																									data.summaryReports[0].total_consumption,
																									data.summaryReports[0].total_consumption
																											+ data.summaryReports[1].total_consumption,
																									data.summaryReports[0].total_consumption
																											+ data.summaryReports[1].total_consumption
																											+ data.summaryReports[2].total_consumption,
																									data.summaryReports[0].total_consumption
																											+ data.summaryReports[1].total_consumption
																											+ data.summaryReports[2].total_consumption
																											+ data.summaryReports[3].total_consumption,
																									data.summaryReports[0].total_consumption
																											+ data.summaryReports[1].total_consumption
																											+ data.summaryReports[2].total_consumption
																											+ data.summaryReports[3].total_consumption
																											+ data.summaryReports[4].total_consumption,
																									data.summaryReports[0].total_consumption
																											+ data.summaryReports[1].total_consumption
																											+ data.summaryReports[2].total_consumption
																											+ data.summaryReports[3].total_consumption
																											+ data.summaryReports[4].total_consumption
																											+ data.summaryReports[5].total_consumption,
																									data.summaryReports[0].total_consumption
																											+ data.summaryReports[1].total_consumption
																											+ data.summaryReports[2].total_consumption
																											+ data.summaryReports[3].total_consumption
																											+ data.summaryReports[4].total_consumption
																											+ data.summaryReports[5].total_consumption
																											+ data.summaryReports[6].total_consumption ]
																						} ]
																			};
																			var revenueOption = {
																				title : {
																					text : '总收入'
																				},
																				tooltip : {},
																				legend : {
																					data : [
																							'总收入',
																							'累计收入' ]
																				},
																				xAxis : {
																					data : [
																							data.revenueAndProfitRecords[0].statistics_date,
																							data.revenueAndProfitRecords[1].statistics_date,
																							data.revenueAndProfitRecords[2].statistics_date,
																							data.revenueAndProfitRecords[3].statistics_date,
																							data.revenueAndProfitRecords[4].statistics_date,
																							data.revenueAndProfitRecords[5].statistics_date,
																							data.revenueAndProfitRecords[6].statistics_date ]
																				},
																				yAxis : {},
																				series : [
																						{
																							name : '总收入',
																							type : 'line',
																							data : [
																									data.revenueAndProfitRecords[0].daily_totalRevenue,
																									data.revenueAndProfitRecords[1].daily_totalRevenue,
																									data.revenueAndProfitRecords[2].daily_totalRevenue,
																									data.revenueAndProfitRecords[3].daily_totalRevenue,
																									data.revenueAndProfitRecords[4].daily_totalRevenue,
																									data.revenueAndProfitRecords[5].daily_totalRevenue,
																									data.revenueAndProfitRecords[6].daily_totalRevenue ]
																						},
																						{
																							name : '累计收入',
																							type : 'line',
																							data : [
																									data.revenueAndProfitRecords[0].daily_totalRevenue,
																									data.revenueAndProfitRecords[0].daily_totalRevenue
																											+ data.revenueAndProfitRecords[1].daily_totalRevenue,
																									data.revenueAndProfitRecords[0].daily_totalRevenue
																											+ data.revenueAndProfitRecords[1].daily_totalRevenue
																											+ data.revenueAndProfitRecords[2].daily_totalRevenue,
																									data.revenueAndProfitRecords[0].daily_totalRevenue
																											+ data.revenueAndProfitRecords[1].daily_totalRevenue
																											+ data.revenueAndProfitRecords[2].daily_totalRevenue
																											+ data.revenueAndProfitRecords[3].daily_totalRevenue,
																									data.revenueAndProfitRecords[0].daily_totalRevenue
																											+ data.revenueAndProfitRecords[1].daily_totalRevenue
																											+ data.revenueAndProfitRecords[2].daily_totalRevenue
																											+ data.revenueAndProfitRecords[3].daily_totalRevenue
																											+ data.revenueAndProfitRecords[4].daily_totalRevenue,
																									data.revenueAndProfitRecords[0].daily_totalRevenue
																											+ data.revenueAndProfitRecords[1].daily_totalRevenue
																											+ data.revenueAndProfitRecords[2].daily_totalRevenue
																											+ data.revenueAndProfitRecords[3].daily_totalRevenue
																											+ data.revenueAndProfitRecords[4].daily_totalRevenue
																											+ data.revenueAndProfitRecords[5].daily_totalRevenue,
																									data.revenueAndProfitRecords[0].daily_totalRevenue
																											+ data.revenueAndProfitRecords[1].daily_totalRevenue
																											+ data.revenueAndProfitRecords[2].daily_totalRevenue
																											+ data.revenueAndProfitRecords[3].daily_totalRevenue
																											+ data.revenueAndProfitRecords[4].daily_totalRevenue
																											+ data.revenueAndProfitRecords[5].daily_totalRevenue
																											+ data.revenueAndProfitRecords[6].daily_totalRevenue ]
																						} ]
																			};

																			var profitOption = {
																				title : {
																					text : '总盈利'
																				},
																				tooltip : {},
																				legend : {
																					data : [
																							'总盈利',
																							'累计盈利' ]
																				},
																				xAxis : {
																					data : [
																							data.revenueAndProfitRecords[0].statistics_date,
																							data.revenueAndProfitRecords[1].statistics_date,
																							data.revenueAndProfitRecords[2].statistics_date,
																							data.revenueAndProfitRecords[3].statistics_date,
																							data.revenueAndProfitRecords[4].statistics_date,
																							data.revenueAndProfitRecords[5].statistics_date,
																							data.revenueAndProfitRecords[6].statistics_date ]
																				},
																				yAxis : {},
																				series : [
																						{
																							name : '总盈利',
																							type : 'line',
																							data : [
																									data.revenueAndProfitRecords[0].dayly_totalProfit,
																									data.revenueAndProfitRecords[1].dayly_totalProfit,
																									data.revenueAndProfitRecords[2].dayly_totalProfit,
																									data.revenueAndProfitRecords[3].dayly_totalProfit,
																									data.revenueAndProfitRecords[4].dayly_totalProfit,
																									data.revenueAndProfitRecords[5].dayly_totalProfit,
																									data.revenueAndProfitRecords[6].dayly_totalProfit ]
																						},
																						{
																							name : '累计盈利',
																							type : 'line',
																							data : [
																									data.revenueAndProfitRecords[0].dayly_totalProfit,
																									data.revenueAndProfitRecords[0].dayly_totalProfit
																											+ data.revenueAndProfitRecords[1].dayly_totalProfit,
																									data.revenueAndProfitRecords[0].dayly_totalProfit
																											+ data.revenueAndProfitRecords[1].dayly_totalProfit
																											+ data.revenueAndProfitRecords[2].dayly_totalProfit,
																									data.revenueAndProfitRecords[0].dayly_totalProfit
																											+ data.revenueAndProfitRecords[1].dayly_totalProfit
																											+ data.revenueAndProfitRecords[2].dayly_totalProfit
																											+ data.revenueAndProfitRecords[3].dayly_totalProfit,
																									data.revenueAndProfitRecords[0].dayly_totalProfit
																											+ data.revenueAndProfitRecords[1].dayly_totalProfit
																											+ data.revenueAndProfitRecords[2].dayly_totalProfit
																											+ data.revenueAndProfitRecords[3].dayly_totalProfit
																											+ data.revenueAndProfitRecords[4].dayly_totalProfit,
																									data.revenueAndProfitRecords[0].dayly_totalProfit
																											+ data.revenueAndProfitRecords[1].dayly_totalProfit
																											+ data.revenueAndProfitRecords[2].dayly_totalProfit
																											+ data.revenueAndProfitRecords[3].dayly_totalProfit
																											+ data.revenueAndProfitRecords[4].dayly_totalProfit
																											+ data.revenueAndProfitRecords[5].dayly_totalProfit,
																									data.revenueAndProfitRecords[0].dayly_totalProfit
																											+ data.revenueAndProfitRecords[1].dayly_totalProfit
																											+ data.revenueAndProfitRecords[2].dayly_totalProfit
																											+ data.revenueAndProfitRecords[3].dayly_totalProfit
																											+ data.revenueAndProfitRecords[4].dayly_totalProfit
																											+ data.revenueAndProfitRecords[5].dayly_totalProfit
																											+ data.revenueAndProfitRecords[6].dayly_totalProfit ]
																						} ]
																			};

																			// 使用刚指定的配置项和数据显示图表。
																			rechargeChart
																					.setOption(rechargeOption);
																			consumptionChart
																					.setOption(consumptionOption);
																			revenueChart
																					.setOption(revenueOption);
																			profitChart
																					.setOption(profitOption);

																		});
													}
												}
												layui.form.render("select");
											});
							form
									.on(
											"select",
											function(data) {
												var tmpArr = data.value
														.split("---");
												$
														.post(
																"./weekSummary",
																{
																	monday : tmpArr[1],
																	sunday : tmpArr[0]
																},
																function(result) {
																	var rechargeChart = echarts
																			.init(document
																					.getElementById('rechargeChart'));
																	var consumptionChart = echarts
																			.init(document
																					.getElementById('consumptionChart'));
																	var revenueChart = echarts
																			.init(document
																					.getElementById('revenueChart'));
																	var profitChart = echarts
																			.init(document
																					.getElementById('profitChart'));
																	var rechargeOption = {
																		title : {
																			text : '充值总额'
																		},
																		tooltip : {},
																		legend : {
																			data : [
																					'充值总额',
																					'累计充值' ]
																		},
																		xAxis : {
																			data : [
																					result.summaryReports[0].business_date,
																					result.summaryReports[1].business_date,
																					result.summaryReports[2].business_date,
																					result.summaryReports[3].business_date,
																					result.summaryReports[4].business_date,
																					result.summaryReports[5].business_date,
																					result.summaryReports[6].business_date ]
																		},
																		yAxis : {},
																		series : [
																				{
																					name : '充值总额',
																					type : 'line',
																					data : [
																							result.summaryReports[0].total_recharge,
																							result.summaryReports[1].total_recharge,
																							result.summaryReports[2].total_recharge,
																							result.summaryReports[3].total_recharge,
																							result.summaryReports[4].total_recharge,
																							result.summaryReports[5].total_recharge,
																							result.summaryReports[6].total_recharge ]
																				},
																				{
																					name : '累计充值',
																					type : 'line',
																					data : [
																							result.summaryReports[0].total_recharge,
																							result.summaryReports[0].total_recharge
																									+ result.summaryReports[1].total_recharge,
																							result.summaryReports[0].total_recharge
																									+ result.summaryReports[1].total_recharge
																									+ result.summaryReports[2].total_recharge,
																							result.summaryReports[0].total_recharge
																									+ result.summaryReports[1].total_recharge
																									+ result.summaryReports[2].total_recharge
																									+ result.summaryReports[3].total_recharge,
																							result.summaryReports[0].total_recharge
																									+ result.summaryReports[1].total_recharge
																									+ result.summaryReports[2].total_recharge
																									+ result.summaryReports[3].total_recharge
																									+ result.summaryReports[4].total_recharge,
																							result.summaryReports[0].total_recharge
																									+ result.summaryReports[1].total_recharge
																									+ result.summaryReports[2].total_recharge
																									+ result.summaryReports[3].total_recharge
																									+ result.summaryReports[4].total_recharge
																									+ result.summaryReports[5].total_recharge,
																							result.summaryReports[0].total_recharge
																									+ result.summaryReports[1].total_recharge
																									+ result.summaryReports[2].total_recharge
																									+ result.summaryReports[3].total_recharge
																									+ result.summaryReports[4].total_recharge
																									+ result.summaryReports[5].total_recharge
																									+ result.summaryReports[6].total_recharge ]
																				} ]
																	};
																	var consumptionOption = {
																		title : {
																			text : '消费总额'
																		},
																		tooltip : {},
																		legend : {
																			data : [
																					'消费总额',
																					'累计消费' ]
																		},
																		xAxis : {
																			data : [
																					result.summaryReports[0].business_date,
																					result.summaryReports[1].business_date,
																					result.summaryReports[2].business_date,
																					result.summaryReports[3].business_date,
																					result.summaryReports[4].business_date,
																					result.summaryReports[5].business_date,
																					result.summaryReports[6].business_date ]
																		},
																		yAxis : {},
																		series : [
																				{
																					name : '消费总额',
																					type : 'line',
																					data : [
																							result.summaryReports[0].total_consumption,
																							result.summaryReports[1].total_consumption,
																							result.summaryReports[2].total_consumption,
																							result.summaryReports[3].total_consumption,
																							result.summaryReports[4].total_consumption,
																							result.summaryReports[5].total_consumption,
																							result.summaryReports[6].total_consumption ]
																				},
																				{
																					name : '累计消费',
																					type : 'line',
																					data : [
																							result.summaryReports[0].total_consumption,
																							result.summaryReports[0].total_consumption
																									+ result.summaryReports[1].total_consumption,
																							result.summaryReports[0].total_consumption
																									+ result.summaryReports[1].total_consumption
																									+ result.summaryReports[2].total_consumption,
																							result.summaryReports[0].total_consumption
																									+ result.summaryReports[1].total_consumption
																									+ result.summaryReports[2].total_consumption
																									+ result.summaryReports[3].total_consumption,
																							result.summaryReports[0].total_consumption
																									+ result.summaryReports[1].total_consumption
																									+ result.summaryReports[2].total_consumption
																									+ result.summaryReports[3].total_consumption
																									+ result.summaryReports[4].total_consumption,
																							result.summaryReports[0].total_consumption
																									+ result.summaryReports[1].total_consumption
																									+ result.summaryReports[2].total_consumption
																									+ result.summaryReports[3].total_consumption
																									+ result.summaryReports[4].total_consumption
																									+ result.summaryReports[5].total_consumption,
																							result.summaryReports[0].total_consumption
																									+ result.summaryReports[1].total_consumption
																									+ result.summaryReports[2].total_consumption
																									+ result.summaryReports[3].total_consumption
																									+ result.summaryReports[4].total_consumption
																									+ result.summaryReports[5].total_consumption
																									+ result.summaryReports[6].total_consumption ]
																				} ]
																	};
																	var revenueOption = {
																		title : {
																			text : '总收入'
																		},
																		tooltip : {},
																		legend : {
																			data : [
																					'总收入',
																					'累计收入' ]
																		},
																		xAxis : {
																			data : [
																					result.revenueAndProfitRecords[0].statistics_date,
																					result.revenueAndProfitRecords[1].statistics_date,
																					result.revenueAndProfitRecords[2].statistics_date,
																					result.revenueAndProfitRecords[3].statistics_date,
																					result.revenueAndProfitRecords[4].statistics_date,
																					result.revenueAndProfitRecords[5].statistics_date,
																					result.revenueAndProfitRecords[6].statistics_date ]
																		},
																		yAxis : {},
																		series : [
																				{
																					name : '总收入',
																					type : 'line',
																					data : [
																							result.revenueAndProfitRecords[0].daily_totalRevenue,
																							result.revenueAndProfitRecords[1].daily_totalRevenue,
																							result.revenueAndProfitRecords[2].daily_totalRevenue,
																							result.revenueAndProfitRecords[3].daily_totalRevenue,
																							result.revenueAndProfitRecords[4].daily_totalRevenue,
																							result.revenueAndProfitRecords[5].daily_totalRevenue,
																							result.revenueAndProfitRecords[6].daily_totalRevenue ]
																				},
																				{
																					name : '累计收入',
																					type : 'line',
																					data : [
																							result.revenueAndProfitRecords[0].daily_totalRevenue,
																							result.revenueAndProfitRecords[0].daily_totalRevenue
																									+ result.revenueAndProfitRecords[1].daily_totalRevenue,
																							result.revenueAndProfitRecords[0].daily_totalRevenue
																									+ result.revenueAndProfitRecords[1].daily_totalRevenue
																									+ result.revenueAndProfitRecords[2].daily_totalRevenue,
																							result.revenueAndProfitRecords[0].daily_totalRevenue
																									+ result.revenueAndProfitRecords[1].daily_totalRevenue
																									+ result.revenueAndProfitRecords[2].daily_totalRevenue
																									+ result.revenueAndProfitRecords[3].daily_totalRevenue,
																							result.revenueAndProfitRecords[0].daily_totalRevenue
																									+ result.revenueAndProfitRecords[1].daily_totalRevenue
																									+ result.revenueAndProfitRecords[2].daily_totalRevenue
																									+ result.revenueAndProfitRecords[3].daily_totalRevenue
																									+ result.revenueAndProfitRecords[4].daily_totalRevenue,
																							result.revenueAndProfitRecords[0].daily_totalRevenue
																									+ result.revenueAndProfitRecords[1].daily_totalRevenue
																									+ result.revenueAndProfitRecords[2].daily_totalRevenue
																									+ result.revenueAndProfitRecords[3].daily_totalRevenue
																									+ result.revenueAndProfitRecords[4].daily_totalRevenue
																									+ result.revenueAndProfitRecords[5].daily_totalRevenue,
																							result.revenueAndProfitRecords[0].daily_totalRevenue
																									+ result.revenueAndProfitRecords[1].daily_totalRevenue
																									+ result.revenueAndProfitRecords[2].daily_totalRevenue
																									+ result.revenueAndProfitRecords[3].daily_totalRevenue
																									+ result.revenueAndProfitRecords[4].daily_totalRevenue
																									+ result.revenueAndProfitRecords[5].daily_totalRevenue
																									+ result.revenueAndProfitRecords[6].daily_totalRevenue ]
																				} ]
																	};

																	var profitOption = {
																		title : {
																			text : '总盈利'
																		},
																		tooltip : {},
																		legend : {
																			data : [
																					'总盈利',
																					'累计盈利' ]
																		},
																		xAxis : {
																			data : [
																					result.revenueAndProfitRecords[0].statistics_date,
																					result.revenueAndProfitRecords[1].statistics_date,
																					result.revenueAndProfitRecords[2].statistics_date,
																					result.revenueAndProfitRecords[3].statistics_date,
																					result.revenueAndProfitRecords[4].statistics_date,
																					result.revenueAndProfitRecords[5].statistics_date,
																					result.revenueAndProfitRecords[6].statistics_date ]
																		},
																		yAxis : {},
																		series : [
																				{
																					name : '总盈利',
																					type : 'line',
																					data : [
																							result.revenueAndProfitRecords[0].dayly_totalProfit,
																							result.revenueAndProfitRecords[1].dayly_totalProfit,
																							result.revenueAndProfitRecords[2].dayly_totalProfit,
																							result.revenueAndProfitRecords[3].dayly_totalProfit,
																							result.revenueAndProfitRecords[4].dayly_totalProfit,
																							result.revenueAndProfitRecords[5].dayly_totalProfit,
																							result.revenueAndProfitRecords[6].dayly_totalProfit ]
																				},
																				{
																					name : '累计盈利',
																					type : 'line',
																					data : [
																							result.revenueAndProfitRecords[0].dayly_totalProfit,
																							result.revenueAndProfitRecords[0].dayly_totalProfit
																									+ result.revenueAndProfitRecords[1].dayly_totalProfit,
																							result.revenueAndProfitRecords[0].dayly_totalProfit
																									+ result.revenueAndProfitRecords[1].dayly_totalProfit
																									+ result.revenueAndProfitRecords[2].dayly_totalProfit,
																							result.revenueAndProfitRecords[0].dayly_totalProfit
																									+ result.revenueAndProfitRecords[1].dayly_totalProfit
																									+ result.revenueAndProfitRecords[2].dayly_totalProfit
																									+ result.revenueAndProfitRecords[3].dayly_totalProfit,
																							result.revenueAndProfitRecords[0].dayly_totalProfit
																									+ result.revenueAndProfitRecords[1].dayly_totalProfit
																									+ result.revenueAndProfitRecords[2].dayly_totalProfit
																									+ result.revenueAndProfitRecords[3].dayly_totalProfit
																									+ result.revenueAndProfitRecords[4].dayly_totalProfit,
																							result.revenueAndProfitRecords[0].dayly_totalProfit
																									+ result.revenueAndProfitRecords[1].dayly_totalProfit
																									+ result.revenueAndProfitRecords[2].dayly_totalProfit
																									+ result.revenueAndProfitRecords[3].dayly_totalProfit
																									+ result.revenueAndProfitRecords[4].dayly_totalProfit
																									+ result.revenueAndProfitRecords[5].dayly_totalProfit,
																							result.revenueAndProfitRecords[0].dayly_totalProfit
																									+ result.revenueAndProfitRecords[1].dayly_totalProfit
																									+ result.revenueAndProfitRecords[2].dayly_totalProfit
																									+ result.revenueAndProfitRecords[3].dayly_totalProfit
																									+ result.revenueAndProfitRecords[4].dayly_totalProfit
																									+ result.revenueAndProfitRecords[5].dayly_totalProfit
																									+ result.revenueAndProfitRecords[6].dayly_totalProfit ]
																				} ]
																	};
																	rechargeChart
																			.setOption(rechargeOption);
																	consumptionChart
																			.setOption(consumptionOption);
																	revenueChart
																			.setOption(revenueOption);
																	profitChart
																			.setOption(profitOption);
																});
											});

						});
	</script>
</body>
</html>
